package com.tenement.netty.service.impl;

import com.alibaba.fastjson.JSON;
import com.tenement.entity.ChatModel;
import com.tenement.netty.service.ChatHandlerService;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;

import java.util.Map;
import java.util.Set;

public class ActiveServiceImpl implements ChatHandlerService {
    @Override
    public void execute(ChatModel chatModel, ChannelHandlerContext channelHandlerContext, Map<String, Channel> privateChannel, Set<Channel> channelGroups) {
        channelHandlerContext.channel().writeAndFlush(new TextWebSocketFrame(JSON.toJSONString(chatModel.setType( (short) 4).setMsg("PINK OK"))));
    }
}
